home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / ebl308a.arc / BATDEMO.BAT < prev    next >
DOS Batch File  |  1987-02-15  |  11KB  |  298 lines

  1. bat /p * Loading DEMO ..... (Non-IBM systems, read NOTE within this file)
  2.  
  3. *           Written by F.Canova 10/5/83 through 07/7/86
  4. *   (c) Copyright 1983, 1985, 1986 by Seaware Corp. all rights reserved.
  5. *    This batch file REQUIRES EBL Version 3 for proper execution!
  6.  
  7.          **** NOTE! NOTE! NOTE! NOTE! ****
  8. %D = RAM    |* <-----Change 'RAM' to 'BIOS' if PC isn't 100% IBM Compatible!
  9.  
  10. * For more information or to receive your own copy of EBL ($49) write to:
  11. *             Seaware Corp.
  12. *             P.O. Box 1656
  13. *             Delray Beach, FL 33444
  14.  
  15. *---- FEATURES OF THE LANGUAGE USED WITHIN THIS DEMO ARE: ----------------
  16. * Standary DOS commands can be intermixed freely with BAT commands.
  17. * Like basic, putting things at top is quicker for goto's / loops to find.
  18. * Up to 127 chars are allowed for labels, contents of vars, and literals
  19. * 10 variables are provided to be passed to/from DOS. They're %0 to %9.
  20. * 15 variables are provided for user use only. They're %A to %O.
  21. * The variable %R is a return code that any routine can set at [0:04FE]
  22. * Note that 'BEGTYPE' & 'BEGSTACK' do not do variable substitution.
  23. * BEGTYPE  command can have screen attributes via a '\hex' format.
  24. * BEGSTACK command can have timing attributes via a '\hex' format.
  25. * Spaces are needed to delimit operators.
  26. * Non-spaces will concatenate variables and literals.
  27. * STATEOF sets return code based on state of files existance.
  28.  
  29. color 1f
  30. begtype
  31.  
  32. ┌─────────────────────────────────────────────────────────────────────────┐
  33. │    Welcome to Extended Batch Language Version 3 Demonstration !      │
  34. └─────────────────────────────────────────────────────────────────────────┘\0f
  35.  
  36.     What is your first name? ;
  37. end
  38.        read %8
  39.        %7 = 27
  40.        %L =
  41.        %0 = ( " " & %8 & "'s Extended Batch Sampler Menu                     " ) $ 1 48
  42.        goto -top
  43.  
  44.     * number guessing demo *
  45.  
  46. -i.can.count %6 = 5
  47.        cls type I am thinking of a two digit number, can you guess it?
  48. -c.loop read %5
  49.        if %5 = %7 skip 7
  50.        %6 = %6 - 1
  51.        if %6 <> 0 skip 2
  52.        type Boo hisss! The number was %7!
  53.        skip 4
  54.        if %5 > %7 type Try a little lower. You only get %6 more tries.
  55.        if %5 < %7 type Try a higher number. You get %6 more tries.
  56.        goto -c.loop
  57.        type great! I was afraid you weren't going to get it!
  58.        begtype
  59.  
  60. \1f═════════════════════════════════════════════════════════════════════════════\07
  61.   A BAT program can create loops and count events.  With this you can
  62.   sequence through file numbers, or create loops to do retrys in case of
  63.   errors.  EBL programs can even do arithmetic (up to 19 digits) and string
  64.   manipulation (up to 127 characters mixed case).  In addition, an external
  65.   function BATMATH is provided to registered users when floating point math
  66.   is needed.
  67. \1f═════════════════════════════════════════════════════════════════════════════\07
  68.  
  69. (press any key to continue)
  70. end
  71. inkey
  72.  
  73. -top
  74.     IF %D = RAM then RAM
  75.     ELSE BIOS
  76.     cls begtype
  77. \1f═════════════════════════════════════════════════\07  \17┌─────────────────────────┐\07
  78. \1f\%0 \07  \17│ User supported software │\07
  79. \1f═════════════════════════════════════════════════\07  \17│           by          │\07
  80.                            \17│             │\07
  81.                            \17│ Seaware Corp.        │\07
  82.  \70 C \0f - I can Count                 \17│ P.O. Box 1656          │\07
  83.                            \17│ Delray Beach, FL 33444    │\07
  84.  \70 D \0f - Directory of available programs         \17│ 305/392-2046          │\07
  85.                            \17│             │\07
  86.  \70 F \0f - Testing for files                 \17│ Order your registered   │\07
  87.                            \17│ copy for $49 from us    │\07
  88.  \70 K \0f - Keyboard stack (the invisible fingers)     \17│ directly or our order   │\07
  89.                            \17│ line at 800/622-4070    │\07
  90.  \70 S \0f - Display Screen and String operations     \17│ or 800/942-7317 in IL.  │\07
  91.                            \17│             │\07
  92.  \70 X \0f - Exit                     \17│ Please copy and share   │\07
  93.                            \17│ BAT.COM, BATFUNC1.COM,    │\07
  94.                            \17│ BATDOC.BAT, BATDEMO.BAT │\07
  95. Select an option.                   \17│ for non-commercial uses │\07
  96.                            \17│ only.            │\07
  97.                            \17└─────────────────────────┘\07
  98. END
  99. -entry read %9
  100.     %7 = %7 + 3
  101.     if %9 <> d goto -not.d
  102.     type Enter file.spec for files you would like to see, or press ENTER for all.
  103.     read %1
  104.     if .%1 = . %1 = *.*
  105.     -dirques type Would you like a (S)tandard or (W)ide directory?
  106.     inkey %2 | %m = %2 # | if %m = 1 type %2
  107.     * Notice you can chain togeather if's, like . . .
  108.     if %2 <> s if %2 <> w goto -dirques
  109.     %3 =
  110.     if %2 = w %3 = /w
  111.     cls
  112.     REM  (notice that two parms are passed to DOS here. %%1 and %%3)
  113.     dir %1 %3
  114.     bat * Returning to Extended Batch demo *
  115.     bat /p  * This switch allows pgms to be written without 'bat' prefix.
  116.     begtype
  117.  
  118. \1f═════════════════════════════════════════════════════════════════════════════\07
  119. This directory was created by using a DOS command within this batch file. Any
  120. DOS command can be mixed freely within lines of the BAT program. By passing
  121. parameters to/from DOS, you can have complete control of how a program
  122. operates. User programs may also set a return code in order to control the
  123. execution of the BAT batch file program.
  124. \1f═════════════════════════════════════════════════════════════════════════════\07
  125.  
  126.     Press any key to continue. . .
  127. end
  128.     inkey
  129.     goto -top
  130.  
  131. -not.d if %9 <> x skip 3
  132.     type So long %8....
  133.     type P.S. For quickie help, just enter ''BAT'' from DOS!
  134.     exit
  135.  
  136. if %9 = c goto -i.can.count
  137.  
  138. if %9 <> f goto -not.f
  139. -is.f    type Enter a file name for me to search for.
  140.     read %9
  141.     if /%9 = / then goto -is.f
  142.     type Scanning for file: %9 . . .
  143.     stateof %9 |* this will set the return code up (%R)
  144.     if %r <> 0 skip 2
  145.        type The file does exist - exactly as typed.
  146.        skip 7
  147.     if %r <> 1 skip 2
  148.        type The file does not exist on any drive.
  149.        skip 5
  150.     if %r <> 9 skip 2
  151.        type The file name given is invalid.
  152.        skip 2
  153.     type The file does exist - but was found on the %r drive.
  154.     type To properly find this file, the complete filename would be %9
  155.     begtype
  156.  
  157. \1f═════════════════════════════════════════════════════════════════════════════\07
  158.        File searching is done by a command called STATEOF.
  159.  
  160. If the file was there, we could direct a program to use it, even if it wasn't
  161. on the specific diskette drive that the operator was expecting.
  162.  
  163. If the file was not there, we could have printed out an error message to the
  164. operator, or we could have run an alternate program in order to create the
  165. missing file.
  166.  
  167. Extended Batch Language Version 3 can now also read and write files. This is
  168. useful for making configuration files, setting up printers, etc.
  169. \1f═════════════════════════════════════════════════════════════════════════════\07
  170.  
  171. Press any key to continue . . .
  172. end
  173.     inkey
  174.     goto -top
  175.  
  176. -not.f if %9 <> k goto -not.k
  177.     cls begtype
  178. ╔═════════════════════════════════════════════════════════════════════════════╗
  179. ║                                          ║
  180. ║    The keyboard stack can answer questions to programs automatically.    ║
  181. ║    For example, this DOS command can be responded to from the stack.     ║
  182. ║                                          ║
  183. ╚═════════════════════════════════════════════════════════════════════════════╝
  184. end
  185.     begstack
  186. This text is actually being typed for you from the keyboard stack.
  187. All keys, including control keys and function keys can come from this stack.
  188. Keystrokes can \ff\10even \ff\10have \ff\10delayed \ff\10typing.
  189. \1a
  190. end
  191.     stack.on            |* This makes sure copy can see our stack contents.
  192. rem ... Below is the DOS command that will read the keyboard stack.
  193. copy con: nul:
  194. BAT *returning from DOS command*
  195. bat /p    * This switch allows pgms to be written without 'bat' prefix.
  196.     begtype
  197.  
  198. (press any key to continue)
  199. end
  200.     inkey
  201.     goto -top
  202.  
  203. -not.k if %9 <> s goto -not.s
  204.     cls begtype
  205. ╔═════════════════════════════════════════════════════════════════════════════╗
  206. ║                                          ║
  207. ║    All sorts of screen attributes can be printed on the screen.          ║
  208. ║                                          ║
  209. ║   On monochrome display you see:          On color display you see:       ║
  210. ╚═════════════════════════════════════════════════════════════════════════════╝
  211.  
  212.     \04Normal                Red on Black  \07
  213.     \0fHigh Intensity            High Intensity\07
  214.     \21Underlined                Blue on Green \07
  215.     \85Flashing Normal            Flashing Magenta on Black\07
  216.  
  217.         And \0fmany\07 other combinations!
  218.  
  219. END
  220. >con
  221. begtype
  222. \1b[33;44m Users of ANSI.SYS can also control colors & the display.\1b[0m
  223.  
  224.  
  225. (press any key to continue)
  226. end
  227.     >
  228.     inkey
  229.     cls
  230. -rd.name1
  231.     if .%8 <> . skip 2
  232.       read I didn't catch your first name, what was it? %8
  233.       goto -rd.name1
  234.     type I know that your first name is %8
  235. -rd.name2
  236.     if .%L <> . skip 2
  237.       read I didn't catch your last name, what was it? %L
  238.       goto -rd.name2
  239.     CLS BEGTYPE
  240.  
  241. I am using your name as two strings to work with.
  242.  
  243. Comparisons can be made . . .
  244. END
  245.     if %8 = %L type The strings are equal.
  246.     if %8 <> %L type The strings are not equal.
  247.     * notice a '.' will make sure that null entries can be found
  248.     type
  249.     type Strings contents can be manipulated . . .
  250.     type CONCATENATION.. They can be combined to form %8%L
  251.     type CONCATENATION.. or to form %L%8.
  252.     /U | %I = %8 $ 1 1
  253.     %I = %I.%L $ 1 3   | /U-
  254.     %H = %8 #
  255.     type SUBSTRINGS..... Your initials would be %I.
  256.     type LENGTHS........ Your first name has %H letters.
  257.     begtype
  258.  
  259. \1f═════════════════════════════════════════════════════════════════════════════\07
  260.   Strings will be truncated at 127 characters and may be passed back and
  261.   forth from DOS.  There are 10 variables for strings which may operate with
  262.   DOS, and 15 which can be used even between executing BAT programs.  There
  263.   are another 5 variables which have predefined (fixed) contents to give
  264.   status, etc.    String operations and comparisons can be done as well.    BATXV
  265.   is an external function provided to registered users that can contain
  266.   Extended Variables.  It allows almost unlimited variable space.  It also
  267.   allows flexable variable names, indexing, and array capabilities.
  268. \1f═════════════════════════════════════════════════════════════════════════════\07
  269.  
  270. (Press any key to continue)
  271. end
  272.     inkey
  273.     goto -top
  274.  
  275. -not.s BEGTYPE
  276.  
  277. You did not select a valid option.
  278. Press \0FC, D, F, S or X\07.
  279. END
  280.     goto -entry
  281.  
  282. bat -on.error-
  283. bat begtype
  284.  
  285.      Unexpected error \%R in line \%L !
  286.  
  287.      This batch file was error free when it was distributed
  288.      by Seaware. An error indicates that it was most likely
  289.      modified by someone improperly. To get an updated demo
  290.      diskette send $10 to Seaware directly or call 800/622-4070
  291.      or 800/942-7317 in Illinois.
  292.  
  293.  
  294.             Seaware Corp.
  295.              Post Office Box 1656
  296.             Delray Beach, FL 33444
  297. end
  298.